<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>后台-编辑用户</title>
    <link href="__PUBLIC__/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <link href="__PUBLIC__/alert/sweetalert.css" rel="stylesheet">
    <script src="__PUBLIC__/jquery/jquery1.8.0.js"></script>
    <script src="__PUBLIC__/alert/sweetalert.min.js"></script>
</head>
<style>
body{
    position: relative;
    top: -20px;
}
</style>
<body>

    <nav class="navbar navbar-inverse">
        <div class="container-fluid">
            <div id="navbar" class="navbar-collapse collapse">
                <a class="navbar-brand" href="{:U('Index/index')}">后台管理系统</a>
                <ul class="nav navbar-nav navbar-right">
                    <!--<li><a href="#">Dashboard</a></li>-->
                    <!--<li><a href="#">Settings</a></li>-->
                    <!--<li><a href="#">Profile</a></li>-->
                    <li><a href="">欢迎您，{$Think.session.user_info.name}</a></li>
                    <li><a href="{:U('Login/out')}">退出</a></li>
                </ul>
            </div>
        </div>
    </nav>

    <div class="container-fluid">
        <div class="row">
            <div class="col-sm-2">
                <ul class="nav nav-sidebar">
                    <li><a href="{:U('Index/config')}">配置管理</a></li>
                    <li class="bg-info"><a href="{:U('User/index')}">用户管理</a></li>
                    <li><a href="{:U('Info/index')}">管理记录</a></li>
                    <li><a href="{:U('Info/add')}">添加记录</a></li>
                </ul>
            </div>
            <div class="col-sm-10">
                <h1>编辑用户</h1>
                <hr>
                <form method="post" action="{:U('User/edit',['id'=>$info['id']])}" class="form_info">
                    <div class="form-group">
                        <label for="exampleInputEmail1">用户名：*</label>
                        <input type="text" class="form-control" name="name" id="exampleInputEmail1" value="{$info.name}" placeholder="起个名吧~" required>
                    </div>
                    <div class="form-group">
                        <label for="exampleInputPassword1">密码：*</label>
                        <input type="password" class="form-control" name="passwd" id="exampleInputPassword1" value="" placeholder="请输入用户密码" required>
                    </div>
                    <button type="submit" class="btn btn-default">确定</button>
                </form>
            </div>
        </div>
    </div>
k

</body>
<script>
    $('.form_info').submit(function(){
        var post_data = $(this).serialize();
        var post_url = $(this).attr('action');
        $.ajax({
            url: post_url,
            type: 'post',
            data: post_data,
            dataType:'json',
            success:function(res){
                switch (res.Code){
                    case 300:
                        swal({
                            title: "Succwss",
                            text: res.Message,
                            type: "success",
                        },function(){
                            window.location.href = res.Data.go_url;
                        });
                        break;
                    case 301:
                    case 303:
                    case 305:
                    case 307:
                        swal('失败', res.Message, "error");
                        break;
                }
            },
            error:function(){

            }
        });
        return false;
    });
</script>
</html>
